<section id="content">

    <form action="" id="myform" method="post" onSubmit="return checkForm()">
        <table width="90%" border="0" cellspacing="0" cellpadding="0">
            <input name="call_back" type="hidden" value="call_back" />
            <tr>
                <td align="right" valign="top">会员列表：</td>
                <td>
                    <div class="wi80-BFB re-no viplist" >
                        {volist name="uncustomers" id="list"}
                            <input type="hidden" name="uncustomers_id[]" value="{$list.uncustomers_id}" />
                            <p><span>ID:{$list['uncustomers_id']}</span>&nbsp;<span>昵称:{$list['c_nickname']}</span></p>
                        {/volist}
                    </div>
                </td>
            </tr>
            <tr>
                <td><div>&nbsp;</div></td>
                <td><div>&nbsp;</div></td>
            </tr>
            <tr>
                <td align="right" valign="top">所属用户：</td>
                <td>
                    <select name="user_id">
                        {volist name="users" id="vo"}
                            <option value="{$vo.id}"><?=isset($vo['nickname']) ? $vo['nickname'] : '';?></option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tr style="height:60px">
                <td class="pa-50-0">&nbsp;</td>
                <td align="right">
                    <button type="submit" onclick="ajax_form()" style="padding: 4px 16px;cursor: pointer;"><span>提交</span></button>
                </td>
            </tr>
        </table>
    </form>
    <script type="text/javascript">
        function ajax_form(){
            $.ajax({
                type : "POST",
                url:"{:url('Admin/Uncustomers/dodistribut')}",
                data : $('#myform').serialize(),// 你的formid
                success: function(data){
                    history.go(-1);
                    //window.location.reload();
                    /*layer.closeAll();
                    if (data.code == 1) {
                        layer.msg('分配成功');
                    } else {
                        layer.msg('分配失败');
                    }*/
                }
            });
        }
        function checkform(){
            var user_id = document.getElementById("user_id").value;
            if(!user_id){
                alert("请选择所属用户");
                return false;
            }
            document.getElementById("myform").submit();
        }

    </script>

</section>